// com.example.aftersales.vo.ServiceResult.java
package com.example.aftersales.vo;

import java.io.Serializable;

public class ServiceResult<T> implements Serializable {
    private boolean success;
    private String message;
    private T data;

    public static <T> ServiceResult<T> success(T data) {
        return success(data, "操作成功");
    }

    public static <T> ServiceResult<T> success(T data, String message) {
        ServiceResult<T> result = new ServiceResult<>();
        result.setSuccess(true);
        result.setData(data);
        result.setMessage(message);
        return result;
    }

    public static <T> ServiceResult<T> fail(String message) {
        ServiceResult<T> result = new ServiceResult<>();
        result.setSuccess(false);
        result.setMessage(message);
        return result;
    }

    // Getters and Setters
    public boolean isSuccess() { return success; }
    public void setSuccess(boolean success) { this.success = success; }
    public String getMessage() { return message; }
    public void setMessage(String message) { this.message = message; }
    public T getData() { return data; }
    public void setData(T data) { this.data = data; }
}